const { Sequelize } = require('sequelize');
const config = require('./config/config.json').development;

async function checkUser() {
  const sequelize = new Sequelize(config);
  
  try {
    await sequelize.authenticate();
    console.log('数据库连接成功');
    
    // 查询用户数据
    const [results] = await sequelize.query('SELECT id, name, role, password FROM users WHERE id = 1');
    console.log('用户数据:');
    console.log(results);
    
    // 查询所有用户数据
    const [allUsers] = await sequelize.query('SELECT id, name, role, password FROM users');
    console.log('所有用户:');
    console.log(allUsers);
    
  } catch (error) {
    console.error('查询出错:', error);
  } finally {
    await sequelize.close();
  }
}

checkUser();